import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../views/Home.vue'
Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    redirect: '/login'
  },
  {
    path: '/index',
    name: 'Index',
    redirect: '/home',
    component: () => import('../views/Layout/Index.vue'),
    children: [
      {
        path: '/home',
        name: 'Home',
        component: Home,
        meta: { title: '首页' }
      },
      // 基础组件
      {
        path: '/BaseTable',
        name: 'BaseTable',
        component: () => import('../views/BaseSolutions/BaseTable.vue'),
        meta: { title: '二次封装' }
      },
      {
        path: '/xingTransfer',
        name: 'XingTransfer',
        component: () => import('../views/BaseSolutions/XingTransfer.vue'),
        meta: { title: '自定义穿梭框' }
      },
      {
        path: '/inputTag',
        name: 'inputTag',
        component: () => import('../views/BaseSolutions/inputTag.vue'),
        meta: { title: 'inputTag' }
      },
      // 业务
      {
        path: '/MergeTable',
        name: 'MergeTable',
        component: () => import('../views/BusinessSolutions/MergeTable.vue'),
        meta: { title: '合并单元格' }
      },
      {
        path: '/MultiNotification',
        name: 'MultiNotification',
        component: () => import('../views/BusinessSolutions/MultiNotification.vue'),
        meta: { title: 'MultiNotification' }
      },
      {
        path: '/XingTree',
        name: 'XingTree',
        component: () => import('../views/BusinessSolutions/XingTree.vue'),
        meta: { title: 'XingTree' }
      },
      {
        path: '/Transfer',
        name: 'Transfer',
        component: () => import('../views/BusinessSolutions/Transfer.vue'),
        meta: { title: 'Transfer' }
      },
      {
        path: '/Form',
        name: 'Form',
        component: () => import('../views/BusinessSolutions/Form.vue'),
        meta: { title: 'Form' }
      },
      {
        path: '/md5',
        name: 'md5',
        component: () => import('../views/Tools/md5.vue'),
        meta: { title: 'md5加密' }
      },
      {
        path: '/Date',
        name: 'Date',
        component: () => import('../views/Tools/Date.vue'),
        meta: { title: '日期获取' }
      },
      {
        path: '/Debounce',
        name: 'Debounce',
        component: () => import('../views/Tools/debounce'),
        meta: { title: '防抖节流' }
      },
      {
        path: '/demo',
        name: 'demo',
        component: () => import('../views/Demo/index'),
        meta: { title: 'demo' }
      },
      {
        path: '/formSubmit',
        name: 'formSubmit',
        component: () => import('../views/Demo/formSubmit'),
        meta: { title: 'formSubmit' }
      }
    ]
  },
  {
    path: '/about',
    name: 'about',
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () => import(/* webpackChunkName: "about" */ '../views/About.vue')
  },
  {
    path: '/login',
    name: 'Login',
    component: () => import('../views/Login/Index.vue')
  }
]

const router = new VueRouter({
  routes
})

export default router
